<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div>
        <input type="text" value="" id="keyword">
        <div id="keyDiv"></div>
        <div id="div1"></div>
    </div>
    <script>
    const oInput = document.getElementById('keyword');
    const oDiv = document.getElementById('keyDiv');
    const oDiv1 = document.getElementById('div1');
    const o = {
        keyword: 'LOL'
    }
    const handler = {
        get: function(target, key) {
            console.log('-----------');
            return target[key];
        },
        set: function(target, key, value) {
            oDiv.innerText = value;
            div1.innerText = value;
            target[key] = value;
        }
    }
    const proxyObj = new Proxy(o, handler);
    window.onload = function() {
        
        oInput.value = proxyObj.keyword
        oDiv.innerText = proxyObj.keyword
        div1.innerText = proxyObj.keyword
        oInput.addEventListener('input', function() {
            proxyObj.keyword = this.value 
        })
    }
    </script>
</body>
</html>
